const {Router} = require('express');

const { createPost, getPosts, adminPosts, getPost, getView, likeUser, getUserPosts, getMyPosts, closePost, agreePost, rejectPost, agreeApply, rejectApply, apply, applied, getApplies } = require('../controllers/postControllers');
const authMiddleware = require('../middleware/authMiddleware');
const router = Router();

router.post('/', authMiddleware, createPost)
router.get('/', getPosts)
router.get('/:id', getPost)
router.get('/view/:id', getView)
router.post('/like/:id/:credit', authMiddleware, likeUser)
router.get('/users/:id', getUserPosts)
router.get('/admin/:id', authMiddleware, adminPosts)
router.get('/myposts/:id', getMyPosts)
router.post('/close/:id', closePost)
router.post('/agree/:id', agreePost)
router.post('/reject/:id', rejectPost)
router.post('/agreeApply/:id', agreeApply)
router.post('/rejectApply/:id', rejectApply)
router.post('/apply/:id', authMiddleware, apply)
router.get('/applied/:id', authMiddleware, applied)
router.get('/applies/:id', getApplies)


module.exports = router;